home *** CD-ROM | disk | FTP | other *** search
- Path: news.mistral.co.uk!usenet
- From: mikebarnard@mistral.co.uk (Mike Barnard)
- Newsgroups: comp.lang.c
- Subject: Please Please Help! - pointer notation
- Date: Sat, 24 Feb 1996 16:28:14 GMT
- Organization: Mistral Internet (Brighton)
- Message-ID: <4gnlv9$1fh@news.mistral.co.uk>
- NNTP-Posting-Host: 194.73.212.177
- X-Newsreader: Forte Free Agent 1.0.82
-
- Hi.
-
- I'm reposting this as I've had no replies and I'm still without the
- information.
-
- I've read my C book. I've gotten th C FAQ. I've read the file
- "ptrtutor.txt" a tutorial on pointers. But I havn't seen explained the
- following. Can you help?
-
- Sometimes when prototyping a function the function name is pre-fixed
- by an asterisk. Why? What does it mean? This is a quote from the
- pointer tutorial text by Ted Jensen...
-
-
-
-
- +++++++++++++++++++++++++++++++++++++++++++++
-
- " Of course, what the above program illustrates is a simple way
- of copying a string. After playing with the above until you have
- a good understanding of what is happening, we can proceed to
- creating our own replacement for the standard strcpy() that comes
- with C. It might look like:
-
- char *my_strcpy(char *destination, char *source)
- {
- char *p = destination
- while (*source != '\0')
- {
- *p++ = *source++;
- }
- *p = '\0';
- return destination.
- }
-
- In this case, I have followed the practice used in the
- standard routine of returning a pointer to the destination."
-
- +++++++++++++++++++++++++++++++++++++++++++++
-
-
-
-
-
-
- I can't find an explanation fro the asterisk BEFORE THE FUNCTION NAME.
-
-
-
- Putting an asterisk before a variable name declares it as a pointer
- variable. Putting one before the variable in use means you want to
- access the data pointed to. Why is there sometimes an asterisk AFTER a
- variable?
-
- (And I can't find a quote at the moment...)
-
- All hint's will be of GREAT use. Thanks.
-
-
- ---
- Mic.
- From windy and damp Worthing; England.
- mikebarnard@mistral.co.uk
-
- (I just lost 4 fence panels to the wind here! The cost of
- replacing them could have bought me a new windows compiler!)
-
-